<template>
	<view class="ba-container">
		<view class="doctor-team">
			<view style="margin-right: 20rpx;">
				<image :src="doctorInfo.avatar" style="width: 270rpx; height: 270rpx;"></image>
			</view>
			<view>
				<view class="">
				<span>{{doctorInfo?.name}}</span>
				<span style="font-size: 14px;color: #999999;margin-left: 4rpx;white-space: nowrap;
				 overflow: hidden; text-overflow: ellipsis; display: inline-block; width: 300rpx;">
				 {{doctorInfo?.roleId?.name}}</span>
				</view>
				<navigator
					:url="`/nearbyinstitutions/pages/Institutionslisthome/Institutionslisthome?_id=${doctorInfo.organizationId?._id}`">
					<view style="display: flex; align-items: center;
						">
						<span style="font-size: 12px;color: #999999;line-height: 27px; margin-right: 10rpx;
								white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
								display: inline-block; width: 355rpx; ">
							所属机构: {{(doctorInfo.organizationId)?doctorInfo.organizationId.name:'暂无'}}
						</span>
						<image src="/static/right.png" style="width: 14rpx;height:20rpx ;"></image>
					</view>
				</navigator>
				<navigator
					:url="`/nearbyinstitutions/pages/Institutionslisthome/Institutionslisthome?_id=${doctorInfo.organizationId?._id}`">
					<view style="display: flex; align-items: center;
						">
						<span style="font-size: 12px;color: #999999;line-height: 27px; margin-right: 10rpx;
								white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
								display: inline-block; width: 355rpx;white-space: nowrap; overflow: hidden; 
								text-overflow: ellipsis;">
							所属团队: {{(doctorInfo.organizationId)?doctorInfo.organizationId.name:'暂无'}}
						</span>
						<image src="/static/right.png" style="width: 14rpx;height:20rpx ;"></image>
					</view>
				</navigator>

				<view style="font-size: 12px;color: #999999;line-height: 27px;">
					签约人数：<span style="color: #2984F8;">{{doctorInfo.signNumber}}</span>
				</view>
				<view style="display: flex; align-items: center;">
					<template v-for="(temp,index) in 5">
						<image src="/static/sc.png" style="width: 28rpx;
							 height: 30rpx;" v-if="index<(doctorInfo.rate-1)">
						</image>
						<image src="/static/kongsc.png" style="width: 28rpx; height: 30rpx;" v-else></image>
					</template>
					<span style="font-size: 12px;color: #FDDB78; line-height: 30rpx;
						margin-left: 20rpx;margin-top: 3px;">{{ doctorInfo.rate }}.0</span>
				</view>
			</view>

		</view>
		<view class="item-title">
			<span>医生简介</span>
			</view>
			<view class="">
				<span style="color: #999999;">{{(doctorInfo.roleId.intro)?doctorInfo.roleId.intro:'暂无'}}</span>
			</view>
			<view class="item-title">
			<span>擅长</span>
			</view>
			<view class="">
				<span style="color: #999999;"></span>
			</view>
			<navigator url="">
				<view class="application-btn">
					<button style="width: 670rpx; height: 88rpx;background-color: #2984F8;color: #ffffff;">申请签约</button>
				</view>
			</navigator>
	</view>
</template>

<script setup>
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		ref
	} from 'vue';
	import {
		getDoctorDetailByIdApi
	} from '../../../api/doctormanage';
	
	const doctorInfo = ref({});


	onLoad((options) => {
		getDoctorDetailById(options)
	})



	function getDoctorDetailById(data) {
		getDoctorDetailByIdApi(data).then(res => {
			if (res.code == 200) {
				doctorInfo.value = res.data;
			}
		})
	}
</script>

<style scoped lang="scss">
	.ba-container {
		min-height: 100vh;
		background-color: aliceblue;
		display: flex;
		flex-direction: column;
		padding: 20rpx 40rpx;
	}

	.doctor-team {
		width: 590rpx;
		border-radius: 22rpx;
		margin: 20rpx 0;
		display: flex;
		align-items: center;
	}
	.item-title {
		font-weight: 500;
		font-size: 18px;
		margin: 30rpx 0;
	}
	.application-btn{
		background-color: #ffffff;
		width: 100%;
		height: 160rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		position: fixed;
		top: 90vh;
		left: 0;
	}
</style>